#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

int strStr(char* haystack, char* needle)
{
    //return strstr(haystack,needle) == NULL ? -1 : strstr(haystack,needle) - haystack;

    char* p = haystack;
    char* q = needle;
    char* t = haystack;
    int count = 0;
    while (*t != '\0')
    {
        p = t;
        q = needle;
        while (*p != '\0' && *q != '\0' && *p == *q)
        {
            p++;
            q++;
        }
        if (*q == '\0')
        {
            break;
        }
        t++;
        count++;
    }
    if (*t == '\0')
        count = -1;

    return count;
}